//
//  UNZipRARService.h
//  ToolLibrary
//
//  Created by mac on 2019/4/21.
//  Copyright © 2019 杨洋. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <SSZipArchive/SSZipArchive.h>
#import <UnrarKit/UnrarKit.h>
#define UNIQUE_KEY( x ) NSString * const x = @#x

enum{
    SARFileTypeZIP,
    SARFileTypeRAR
};

static UNIQUE_KEY( rar );
static UNIQUE_KEY( zip );

typedef void(^Completion)(NSArray *filePaths);
typedef void(^DownLoadFilePath)(NSString *filePath);
typedef void(^Failure)(void);

NS_ASSUME_NONNULL_BEGIN

@interface UNZipRARService : NSObject<SSZipArchiveDelegate>{
    SSZipArchive *_zipArchive;
    NSString *_fileType;
}
/** 需要解压的文件路径 */
@property (nonatomic, strong) NSString *filePath;
/** 解压密码 (没有密码时，无需设置) */
@property (nonatomic, strong) NSString *password;
/** 目标路径 */
@property (nonatomic, strong) NSString *destinationPath;
@property (nonatomic, copy) Completion completionBlock;
@property (nonatomic, copy) DownLoadFilePath downLoadFilePathBlock;
@property (nonatomic, copy) Failure failureBlock;

- (id)initWithPath:(NSString *)path;
- (void)decompress;

@end

NS_ASSUME_NONNULL_END
